<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>系统安装</title>
<link href="{$theme}/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
<link href="{$theme}/bootstrap-3.3.7-dist/css/ace.min.css" rel="stylesheet">
<link href="{$theme}/bootstrap-3.3.7-dist/css/ace-rtl.min.css" rel="stylesheet">
<link href="{$theme}/bootstrap-3.3.7-dist/css/font-awesome.min.css" rel="stylesheet">
<link href="{$theme}/style/base.css" rel="stylesheet" type="text/css">
<script src="{$theme}/js/jquery.min.js"></script>
<script src="{$theme}/js/jquery.fn.js"></script>
<script src="{$theme}/js/tooltipbox.js"></script>
<script src="{$theme}/js/jquery.form.js"></script>
<script src="{$theme}/js/jquery.validate.js"></script>
<script src="{$theme}/js/jquery.cookie.js"></script>
<script src="{$theme}/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script src="{$theme}/bootstrap-3.3.7-dist/js/ace.min.js"></script>
</head>
<body>
<div class="main-content">
<div class="page-content">
  <div class="page-content-area" style="opacity: 0.8;"> <br>
    <div class="page-header">
      <h1> 系统安装 <small><i class="ace-icon fa fa-angle-double-right"></i> 配置信息 </small> </h1>
    </div>
    <div class="row">
      <div class="panel panel-default">
        <div class="panel-body table-responsive">
          <form method="post" class="form-horizontal" role="form" id="submitform" onsubmit="return false">
          	<div class="panel panel-info">
                <div class="panel-heading">
                    文件权限检查
                </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">{$smarty.const.YD_ROOT}config/config.php</label>
                &nbsp;&nbsp;&nbsp;{if is_writable($smarty.const.YD_ROOT|cat:"config/config.php")}<i class="glyphicon glyphicon-ok green"></i>{else}<i class="glyphicon glyphicon-remove dengar">{/if}</i>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">{$smarty.const.YD_ROOT}data/install</label>
                &nbsp;&nbsp;&nbsp;{if is_writable($smarty.const.YD_ROOT|cat:"data/install")}<i class="glyphicon glyphicon-ok green"></i>{else}<i class="glyphicon glyphicon-remove dengar">{/if}</i>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">{$smarty.const.YD_ROOT}data/logs</label>
                &nbsp;&nbsp;&nbsp;{if is_writable($smarty.const.YD_ROOT|cat:"data/logs")}<i class="glyphicon glyphicon-ok green"></i>{else}<i class="glyphicon glyphicon-remove dengar">{/if}</i>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">{$smarty.const.YD_ROOT}data/runtime</label>
                &nbsp;&nbsp;&nbsp;{if is_writable($smarty.const.YD_ROOT|cat:"data/runtime")}<i class="glyphicon glyphicon-ok green"></i>{else}<i class="glyphicon glyphicon-remove dengar">{/if}</i>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">{$smarty.const.YD_ROOT}data/upload</label>
                &nbsp;&nbsp;&nbsp;{if is_writable($smarty.const.YD_ROOT|cat:"data/upload")}<i class="glyphicon glyphicon-ok green"></i>{else}<i class="glyphicon glyphicon-remove dengar">{/if}</i>
              </div>
            </div>
          	<div class="panel panel-info">
                <div class="panel-heading">
                    数据库配置
                </div>
            </div>
			<div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="name">数据库地址</label>
                <input type="text" class="form-control" id="host" name="host" value="localhost" required>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="gname">数据库名称</label>
                <input type="text" class="form-control" id="dbname" name="dbname" value="" required>
              	<input type="checkbox" value="-- " name="createdb">使用已存在数据库
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="email">数据库用户名</label>
                <input type="text" class="form-control" id="user" name="user" value="" required>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="password">数据库密码</label>
                <input type="text" class="form-control" id="pwd" name="pwd" value="">
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="phone">数据库表前缀</label>
                <input type="text" class="form-control" id="prefix" name="prefix" value="dlc_" required>
              </div>
            </div>  
          	<div class="panel panel-info">
                <div class="panel-heading">
                    后台管理员
                </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="password">管理员账号</label>
                <input type="text" class="form-control" id="email" name="email" value="admin@admin.com" required>
              </div>
            </div>
            <div class="form-group ">
              <div class="col-md-6">
                <label class="control-label" for="phone">管理员密码</label>
                <input type="text" class="form-control" id="password" name="password" value="111111" required>
              </div>
            </div>  
                      
            <div class="form-group">
              <div class="col-md-6">
                <button type="submit" class="btn btn-primary btn-lg btn-submit">确定安装</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
var isbusy = false;
$(function(){
	$('#submitform').validate({
		focusInvalid: true,
		rules: {
			//title: {
				//required: true
			//}
		}
	});
	$('.btn-submit').click(function(){
		if(!$('#submitform').valid())return false;
		if(isbusy)return false;
		isbusy = true;
		tooltipbox.loading('正在执行操作...');
		$.post(location.href, $('#submitform').serialize(), function(res){
		    if(res.code == 1){
				location.href = '{siteurl("con=admin/index")}';
			}
			tooltipbox.clear();
			tooltipbox.alert(res.msg);	
			isbusy = false;
		}, 'json').error(function(a, b, c){
			tooltipbox.clear();
			tooltipbox.show('数据或网络错误');
			isbusy = false;
		});
	});
});
</script> 
</body>
</html>
